home *** CD-ROM | disk | FTP | other *** search
/ Programming in Microsoft Windows with C# / Programacion en Microsoft Windows con C#.iso / Codigo / Jugar con las fuentes / TiltedShadow / TiltedShadow.cs next >
Encoding:
Text File  |  2002-06-18  |  1.3 KB  |  46 lines

  1. //-------------------------------------------
  2. // TiltedShadow.cs ⌐ 2001 by Charles Petzold
  3. //-------------------------------------------
  4. using System;
  5. using System.Drawing;
  6. using System.Drawing.Drawing2D;
  7. using System.Windows.Forms;
  8.  
  9. class TiltedShadow: FontMenuForm
  10. {
  11.      public new static void Main()
  12.      {
  13.           Application.Run(new TiltedShadow());
  14.      }
  15.      public TiltedShadow()
  16.      {
  17.           Text = "Sombra inclinada";
  18.  
  19.           strText = "Sombra";
  20.           font = new Font("Times New Roman", 54);
  21.      }
  22.      protected override void DoPage(Graphics grfx, Color clr, int cx, int cy)
  23.      {
  24.           float fAscent = GetAscent(grfx, font);
  25.  
  26.                // Definir la lφnea base en 3/4 sobre el ßrea de cliente.
  27.  
  28.           grfx.TranslateTransform(0, 3 * cy / 4);
  29.  
  30.                // Guardar el estado de los grßficos.
  31.  
  32.           GraphicsState grfxstate = grfx.Save();
  33.  
  34.                // Definir el escalado e inclinaci≤n, y dibujar la sombra.
  35.  
  36.           grfx.MultiplyTransform(new Matrix(1, 0, -3, 3, 0, 0)); 
  37.           grfx.DrawString(strText, font, Brushes.DarkGray, 0, -fAscent);
  38.  
  39.                // Dibujar texto sin escalado o inclinaci≤n.
  40.  
  41.           grfx.Restore(grfxstate);
  42.           grfx.DrawString(strText, font, Brushes.Black, 0, -fAscent);
  43.      }
  44. }
  45.  
  46.